
# Have a look at _court_positions.info for documentation

# COURT POSITIONS
# court_physician_court_position
# cultural_emissary_court_position
# keeper_of_swans_court_position
# chief_qadi_court_position
# garuda_court_position
# court_gardener_court_position
# lady_in_waiting_court_position
# antiquarian_court_position
# travel_leader_court_position
# wet_nurse_court_position
# court_tutor_court_position
# food_taster_court_position
# master_of_horse_court_position
# master_of_hunt_court_position
# royal_architect_court_position
# high_almoner_court_position
# seneschal_court_position
# cupbearer_court_position
# chief_eunuch_court_position
# court_jester_court_position
# court_poet_court_position
# court_musician_court_position
# bodyguard_court_position
# champion_court_position
# executioner_court_position
# court_artificer_court_position
# master_assassin_court_position
# court_cave_hermit_position

court_physician_court_position = {
	max_available_positions = 1
	category = court_position_category_common

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		# Skill
		add = {
			value = learning
			multiply = 1.75
			max = 50
			desc = court_position_skill_learning
		}
		# Physician
		if = {
			limit = { has_trait = lifestyle_physician }
			add = {
				value = 15
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_physician value >= 50 }
					}
					add = 15
				}
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_physician value >= 100 }
					}
					add = 15
				}
				desc = court_position_physician_1_trait
			}
		}
		# Mystic
		if = {
			limit = { has_trait = lifestyle_mystic }
			add = {
				value = 5
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_mystic value >= 50 }
					}
					add = 5
				}
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_mystic value >= 100 }
					}
					add = 5
				}
				desc = court_position_mystic_1_trait
			}
		}
		# Herbalist
		if = {
			limit = { has_trait = lifestyle_herbalist }
			add = {
				value = 15
				desc = court_position_herbalist_trait
			}
		}
		# Education
		if = {
			limit = { has_trait = education_learning }
			add = {
				value = 4
				if = {
					limit = { has_trait = education_learning_2 }
					add = 4
				}
				else_if = {
					limit = { has_trait = education_learning_3 }
					add = 8
				}
				else_if = {
					limit = { has_trait = education_learning_4 }
					add = 12
				}
				else_if = {
					limit = { has_trait = education_learning_5 }
					add = 22
				}
				desc = education_learning
			}
		}
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		#if = {
		#	limit = {
		#		culture = { has_cultural_parameter = court_physicians_are_better }
		#	}
		#	add = {
		#		value = learning
		#		desc = court_physician_tradition_bonus
		#	}
		#}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = { }

	# Is this an available position for this court? (root is court owner)
	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}


	valid_character = {
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_physician_court_position
					any_court_position_holder = {
				        type = court_physician_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		gold = {
			value = court_position_physician_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_physician_court_position
						any_court_position_holder = {
					        type = court_physician_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_physician_court_position
						any_court_position_holder = {
					        type = court_physician_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
		round = no
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.10
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.10
		}
		average = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.15
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.20
		}
		excellent = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.25
		}
	}

	custom_employer_modifier_description = court_physician_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
		learning = 1
	}

	#custom_employee_modifier_description = court_physician_employee_custom_effect_description

	on_court_position_received = {
		court_physician_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		court_physician_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_physician_title_invalidated_effect = yes
	}

	search_for_courtier = {
		send_interface_toast = {
			title = hire_physician_decision
			custom_tooltip = hire_physician_decision_effect_tooltip
		}
		hidden_effect = {
			add_character_flag = {
				flag = health_3001_hire_physician_decision_text
				days = 20
			}
		}

		trigger_event = {
			id = health.3001
			days = 14
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
        value = 150
        add = scope:base_value
        add = court_position_candidate_score_base_value
        add = court_position_candidate_aptitude_value
		# No debt considerations for Physicians, they are too important
        # AI is less likely to fire the court physician, unless they have a better candidate.
        if = {
            limit = {
                exists = scope:firing_court_position
            }
            add = 200
            scope:employee = {
                # Does the liege have a better candidate that they should be hiring instead?
                if = {
                    limit = {
                        scope:highest_available_aptitude > scope:employee_aptitude
                    }
                    add = -150
                }
            }
        }

        add = adjust_court_position_score_for_unity
    }
}

cultural_emissary_court_position = {
	max_available_positions = 1
	category = court_position_category_special
	minimum_rank = county

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }
	
	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		add = {
			value = num_of_known_languages
			subtract = 1
			multiply = 10
			max = 100
			desc = court_position_languages
		}
		if = {
			limit = {
				has_trait = just
			}
			add = {
				value = 15
				desc = court_position_just_trait
			}
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 15
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = diplomat
			}
			add = {
				value = 30
				desc = court_position_diplomat_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}
	
	# Is this an available position for this court? (root is court owner)
	is_shown = {
		exists = dynasty
		dynasty = {
			has_dynasty_perk = ep1_culture_legacy_4
		}
	}
	
	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}
	# Is this a valid position for this character? Also checks the scripted rule "is_eligible_for_court_positions" in code. (root is potential position holder)
	valid_character = {
		scope:employee = {
			diplomacy >= 8
		}
	}
	
	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = cultural_emissary_court_position
					any_court_position_holder = {
				        type = cultural_emissary_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}
	
	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = cultural_emissary_court_position
						any_court_position_holder = {
					        type = cultural_emissary_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = cultural_emissary_court_position
						any_court_position_holder = {
					        type = cultural_emissary_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	scaling_employer_modifiers = {
		terrible = {
			different_culture_opinion = 2
			monthly_prestige = 0.1
		}
		poor = {
			different_culture_opinion = 5
			monthly_prestige = 0.2
		}
		average = {
			different_culture_opinion = 10
			monthly_prestige = 0.4
		}
		good = {
			different_culture_opinion = 15
			monthly_prestige = 0.7
		}
		excellent = {
			different_culture_opinion = 20
			monthly_prestige = 1
		}
	}
	
	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}
	
	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
	}
}

keeper_of_swans_court_position = {
	max_available_positions = 1
	category = court_position_category_special
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 40
		add = {
			value = stewardship
			multiply = 4
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 100 }
			}
			add = { 
				value = 20
				desc = court_position_hunter_3_trait
			}
		}
		else_if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 50 }
			}
			add = { 
				value = 10
				desc = court_position_hunter_2_trait
			}
		}
		else_if = {
			limit = { has_trait = lifestyle_hunter }
			add = { 
				value = 5
				desc = court_position_hunter_1_trait
			}
		}
		if = {
			limit = {
				has_trait = blind # Can't see the damn birds
			}
			add = {
				value = -20
				desc = court_position_blind_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_title = title:k_england #This has only been a thing in England
	}

	valid_position = {
		has_title = title:k_england #This has only been a thing in England
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}


	valid_character = {
		scope:employee = {
			OR = {
				is_vassal_of = scope:liege
				is_courtier_of = scope:liege
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = keeper_of_swans_court_position
					any_court_position_holder = {
				        type = keeper_of_swans_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = keeper_of_swans_court_position
						any_court_position_holder = {
					        type = keeper_of_swans_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = keeper_of_swans_court_position
						any_court_position_holder = {
					        type = keeper_of_swans_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}
	
	base_employer_modifier = {
		diplomacy_per_prestige_level = 1
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
		}
		poor = {
			court_grandeur_baseline_add = 1
		}
		average = {
			court_grandeur_baseline_add = 1
		}
		good = {
			court_grandeur_baseline_add = 2
		}
		excellent = {
			court_grandeur_baseline_add = 2
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		keeper_of_swans_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		keeper_of_swans_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		keeper_of_swans_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 25
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
	}
}

chief_qadi_court_position = {
	max_available_positions = 1
	category = court_position_category_special
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }
	
	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = generous
			}
			add = {
				value = 15
				desc = court_position_generous_trait
			}
		}
		if = {
			limit = {
				has_trait = just
			}
			add = {
				value = 15
				desc = court_position_just_trait
			}
		}
		if = {
			limit = {
				has_trait = temperate
			}
			add = {
				value = 15
				desc = court_position_temperate_trait
			}
		}
		if = {
			limit = {
				has_trait = scholar
			}
			add = {
				value = 15
				desc = court_position_scholar_trait
			}
		}
		if = {
			limit = {
				has_trait = greedy
			}
			add = {
				value = -10
				desc = court_position_greedy_trait
			}
		}
		if = {
			limit = {
				has_trait = arbitrary
			}
			add = {
				value = -10
				desc = court_position_arbitrary_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}
	
	# Is this an available position for this court? (root is court owner)
	is_shown = {
		has_religion = religion:islam_religion
	}
	
	valid_position = {
		has_religion = religion:islam_religion
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			has_religion = religion:islam_religion
			has_trait = education_learning
			trigger_if = {
				limit = {
					scope:liege.faith = {
						has_doctrine = doctrine_gender_male_dominated
					}
				}
				is_male = yes
			}
			trigger_if = {
				limit = {
					scope:liege.faith = {
						has_doctrine = doctrine_gender_female_dominated
					}
				}
				is_female = yes
			}
		}
	}
	
	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = chief_qadi_court_position
					any_court_position_holder = {
				        type = chief_qadi_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}
	
	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = chief_qadi_court_position
						any_court_position_holder = {
					        type = chief_qadi_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = chief_qadi_court_position
						any_court_position_holder = {
					        type = chief_qadi_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}
	
	base_employer_modifier = {
	}
	
	scaling_employer_modifiers = {
		terrible = {
			monthly_piety_gain_mult = 0.02
		}
		poor = {
			monthly_piety_gain_mult = 0.04
		}
		average = {
			monthly_piety_gain_mult = 0.06
			stewardship = 1
		}
		good = {
			monthly_piety_gain_mult = 0.08
			stewardship = 2
		}
		excellent = {
			monthly_piety_gain_mult = 0.1
			stewardship = 3
		}
	}
	
	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
		stewardship = 1
	}
	
	on_court_position_received = {
		basic_gained_court_position_effect = yes #chief_qadi_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes #chief_qadi_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes #chief_qadi_title_invalidated_effect = yes
	}
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			if = {
				limit = {
					ai_zeal >= -25
				}
				add = 50
			}
		}
		add = court_position_debt_considerations_value
	}
}

garuda_court_position = {
	max_available_positions = 5
	category = court_position_category_special
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = martial
			multiply = 2.5
			max = 50
			desc = court_position_skill_martial
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = { 
				value = 30
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = { 
				value = 15
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = { 
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}

	# Is this an available position for this court? (root is court owner)
	is_shown = {
		culture = { has_cultural_parameter = unlock_garuda_warrior_title }
	}
	
	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			is_knight = yes
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = garuda_court_position
					any_court_position_holder = {
				        type = garuda_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = garuda_court_position
						any_court_position_holder = {
					        type = garuda_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = garuda_court_position
						any_court_position_holder = {
					        type = garuda_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.05
		}
		poor = {
			dread_gain_mult = 0.1
			dread_decay_mult = -0.1
			monthly_court_grandeur_change_mult = 0.05
		}
		average = {
			dread_gain_mult = 0.2
			dread_decay_mult = -0.2
			monthly_court_grandeur_change_mult = 0.10
		}
		good = {
			dread_gain_mult = 0.4
			dread_decay_mult = -0.4
			monthly_court_grandeur_change_mult = 0.10
		}
		excellent = {
			dread_gain_mult = 0.7
			dread_decay_mult = -0.7
			monthly_court_grandeur_change_mult = 0.15
		}
	}

	custom_employer_modifier_description = garuda_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_cost
		prowess = garuda_prowess_svalue
	}

	on_court_position_received = {
		garuda_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		garuda_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		garuda_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value

		scope:liege = {
			# Less likely to hire an additional one if you're already employing one
			if = {
				limit = {
					employs_court_position = garuda_court_position
				}
				add = -50
			}
		}
		add = court_position_debt_considerations_value
	}
}

court_gardener_court_position = {
	max_available_positions = 1
	category = court_position_category_special
	minimum_rank = county

	opinion = {
		value = regular_court_position_opinion
	}
	
	aptitude_level_breakpoints = { 20 40 60 80 }
	
	aptitude = {
		value = 1
		add = {
			value = stewardship
			multiply = 2.5
			max = 60
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				has_trait = lifestyle_gardener
			}
			add = {
				value = 20
				desc = court_position_gardener_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 10
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = patient
			}
			add = {
				value = 10
				desc = court_position_patient_trait
			}
		}
		if = { # Architect gives a tiny bonus, since building stuff is also a part of gardening
			limit = {
				has_trait = architect
			}
			add = {
				value = 5
				desc = court_position_architect_trait
			}
		}
		add = court_position_aptitude_family_business_value
	}
	
	# Is this an available position for this court? (root is court owner)
	is_shown = {
		culture = { has_cultural_parameter = can_appoint_court_gardener }
	}
	
	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			trigger_if = {
				limit = { NOT = { has_court_position = court_gardener_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}
	
	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_gardener_court_position
					any_court_position_holder = {
				        type = court_gardener_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}
	
	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_gardener_court_position
						any_court_position_holder = {
					        type = court_gardener_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_gardener_court_position
						any_court_position_holder = {
					        type = court_gardener_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}
	
	base_employer_modifier = {
		courtier_and_guest_opinion = 10
	}
	
	scaling_employer_modifiers = {
		terrible = {
			character_capital_county_monthly_development_growth_add = 0.1
		}
		poor = {
			character_capital_county_monthly_development_growth_add = 0.25
		}
		average = {
			character_capital_county_monthly_development_growth_add = 0.4
		}
		good = {
			character_capital_county_monthly_development_growth_add = 0.55
		}
		excellent = {
			character_capital_county_monthly_development_growth_add = 0.7
		}
	}
	
	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}
	
	on_court_position_received = {
		court_gardener_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_gardener_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_gardener_title_invalidated_effect = yes
	}
	
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
	}
}

lady_in_waiting_court_position = {
	max_available_positions = 2
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 40
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = {
				value = 10
				desc = court_position_honest_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
		is_female = yes
	}

	valid_position = {
		is_female = yes
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			is_female = yes
			trigger_if = {
				limit = { NOT = { has_court_position = lady_in_waiting_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = lady_in_waiting_court_position
					any_court_position_holder = {
				        type = lady_in_waiting_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = lady_in_waiting_court_position
						any_court_position_holder = {
					        type = lady_in_waiting_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = lady_in_waiting_court_position
						any_court_position_holder = {
					        type = lady_in_waiting_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			stress_loss_mult = 0.10
			hostile_scheme_resistance_add = 1
		}
		poor = {
			stress_loss_mult = 0.15
			hostile_scheme_resistance_add = 2
		}
		average = {
			stress_loss_mult = 0.15
			hostile_scheme_resistance_add = 5
		}
		good = {
			stress_loss_mult = 0.15
			hostile_scheme_resistance_add = 7
		}
		excellent = {
			stress_loss_mult = 0.20
			hostile_scheme_resistance_add = 10
		}
	}

	modifier = {
		monthly_prestige = medium_court_position_prestige_salary
	}

	on_court_position_received = {
		lady_in_waiting_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		lady_in_waiting_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		lady_in_waiting_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value 
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Opinion affects how likely they are to be hired
			if = {
				limit = {
					has_relation_lover = scope:employee
				}
				add = 100
			}
			else_if = {
				limit = {
					has_relation_friend = scope:employee
				}
				add = 75
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= high_positive_opinion
					}
				}
				add = 50
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= medium_positive_opinion
					}
				}
				add = 25
			}

			# Less likely to hire an additional one if you're already employing one
			if = {
				limit = {
					employs_court_position = lady_in_waiting_court_position
				}
				add = -50
			}
		}
		add = court_position_debt_considerations_value
	}
}

antiquarian_court_position = {
	max_available_positions = 1
	category = court_position_category_common

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = learning
			multiply = 2.5
			max = 60
			desc = court_position_skill_learning
		}
		if = { # Characters with a completed inspiration are very good Antiquarians
			limit = {
				has_completed_inspiration = yes
			}
			add = {
				value = 30
				desc = court_position_completed_inspiration
			}
		}
		if = { # Shy characters are likely to spend more time with the artifacts than other people
			limit = {
				has_trait = shy
			}
			add = {
				value = 10
				desc = court_position_shy_trait
			}
		}
		if = {
			limit = {
				has_trait = administrator
			}
			add = {
				value = 10
				desc = court_position_administrator_trait
			}
		}
		if = {
			limit = {
				has_variable = fund_inspiration_6508_architect_improvement
			}
			add = {
				value = 5
				desc = court_position_architect_study_experience
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			trigger_if = {
				limit = { NOT = { has_court_position = antiquarian_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = antiquarian_court_position
					any_court_position_holder = {
				        type = antiquarian_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = court_position_antiquarian_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = antiquarian_court_position
						any_court_position_holder = {
					        type = antiquarian_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = antiquarian_court_position
						any_court_position_holder = {
					        type = antiquarian_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			artifact_decay_reduction_mult = -0.07
		}
		poor = {
			artifact_decay_reduction_mult = -0.11
		}
		average = {
			artifact_decay_reduction_mult = -0.17
		}
		good = {
			artifact_decay_reduction_mult = -0.25
		}
		excellent = {
			artifact_decay_reduction_mult = -0.35
		}
	}
	
	custom_employer_modifier_description = antiquarian_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		antiquarian_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		antiquarian_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		antiquarian_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = {
			limit = {
				scope:liege = {
					highest_held_title_tier >= tier_duchy
				}
			}
			add = 50
		}
		if = {
			limit = {
				scope:liege = {
					highest_held_title_tier >= tier_kingdom
				}
			}
			add = 50
		}
        if = {
            limit = {
                exists = scope:firing_court_position
            }
            add = 100
            scope:employee = {
                # Does the liege have a better candidate that they should be hiring instead?
                if = {
                    limit = {
                        scope:highest_available_aptitude > scope:employee_aptitude
                    }
                    add = -75
                }
            }
        }
		add = court_position_debt_considerations_value
	}
}

travel_leader_court_position = {
	max_available_positions = 1
	category = court_position_category_common
	is_travel_related = yes

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = learning
			multiply = 1
			max = 50
			desc = court_position_skill_learning
		}
		add = {
			value = stewardship
			multiply = 1.3
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				num_of_known_languages >= 2
			}
			add = {
				value = num_of_known_languages
				subtract = 1
				multiply = 5
				max = 50
				desc = court_position_languages
			}
		}

		# SPEED 
		add = {
			value = travel_leader_speed 
			multiply = 1.8
			subtract = 10
			min = 0
			desc = court_position_speed
		}

		# SAFETY 
		add = {
			value = travel_leader_safety 
			multiply = 1.8
			subtract = 10
			min = 0
			desc = court_position_safety
		}

		# POSITIVES
		if = {
			limit = {
				has_trait = adventurer
			}
			add = {
				value = 10 
				desc = court_position_adventurer_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 5 
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 5 
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_hunter
			}
			add = {
				value = 5 
				desc = court_position_hunter_1_trait
			}
		}
		if = {
			limit = {
				has_trait = diligent
			}
			add = {
				value = 5 
				desc = court_position_diligent_trait
			}
		}
		if = {
			limit = {
				has_trait = flexible_leader
			}
			add = {
				value = 10 
				desc = court_position_flexible_leader_trait
			}
		}
		if = {
			limit = {
				has_trait = forest_fighter
			}
			add = {
				value = 10 
				desc = court_position_forest_fighter_trait
			}
		}
		if = {
			limit = {
				has_trait = open_terrain_expert
			}
			add = {
				value = 10 
				desc = court_position_open_terrain_expert_trait
			}
		}
		if = {
			limit = {
				has_trait = rough_terrain_expert
			}
			add = {
				value = 10 
				desc = court_position_rough_terrain_expert_trait
			}
		}
		if = {
			limit = {
				has_trait = desert_warrior
			}
			add = {
				value = 10 
				desc = court_position_desert_warrior_trait
			}
		}
		if = {
			limit = {
				has_trait = jungle_stalker
			}
			add = {
				value = 10 
				desc = court_position_jungle_stalker_trait
			}
		}
		if = {
			limit = {
				has_trait = winter_soldier
			}
			add = {
				value = 10 
				desc = court_position_winter_soldier_trait
			}
		}
		if = {
			limit = {
				has_trait = administrator
			}
			add = {
				value = 5
				desc = court_position_administrator_trait
			}
		}
		if = {
			limit = {
				has_trait = scholar
			}
			add = {
				value = 5
				desc = court_position_scholar_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_physician
			}
			add = {
				value = 5
				desc = court_position_physician_1_trait
			}
		}
		if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler 
					track = travel 
					value >= 75
				}
			}
			add = {
				value = 40
				desc = court_position_traveler_trait_experienced
			}
		}
		else_if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler 
					track = danger 
					value >= 75
				}
			}
			add = {
				value = 40
				desc = court_position_traveler_trait_experienced_danger
			}
		}
		else_if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler 
					track = travel 
					value >= 50
				}
			}
			add = {
				value = 30
				desc = court_position_traveler_trait_experienced
			}
		}
		else_if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler 
					track = danger 
					value >= 50
				}
			}
			add = {
				value = 30
				desc = court_position_traveler_trait_experienced_danger
			}
		}
		else = {
			limit = {
				has_trait = lifestyle_traveler
			}
			add = {
				value = 20
				desc = court_position_traveler_trait
			}
		}
		if = {
			limit = {
				has_character_modifier = ep2_beastmaster_modifier
			}
			add = {
				value = 30
				desc = court_position_beastmaster_modifier
			}
		}

		# NEGATIVES
		if = {
			limit = {
				has_trait = craven
			}
			add = {
				value = -20 
				desc = court_position_craven_trait
			}
		}
		if = {
			limit = {
				has_trait = lazy
			}
			add = {
				value = -10 
				desc = court_position_lazy_trait
			}
		}
		if = {
			limit = {
				has_trait = clubfooted
			}
			add = {
				value = -30 
				desc = court_position_clubfooted_trait
			}
		}
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		if = {
			limit = {
				has_trait = incapable
			}
			multiply = {
				value = 0
				desc = court_position_incapable_trait
			}
		}
		if = {
			limit = {
				has_trait = infirm
			}
			add = {
				value = -50
				desc = court_position_infirm_trait
			}
		}
		if = {
			limit = {
				has_trait = maimed
			}
			add = {
				value = -30
				desc = court_position_maimed_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_reveler
			}
			add = {
				value = -5
				desc = court_position_reveler_1_trait
			}
		}
		min = 0
	}

	is_shown = { }

	# Is this an available position for this court? (root is court owner)
	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
			is_clergy = no 
			bannable_serving_diarch_trigger = no
			NOT = { has_variable = gone_adventuring }
		}
	}

	valid_character = {
		scope:employee = {
			is_clergy = no
			is_imprisoned = no
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			trigger_if = {
				limit = { NOT = { has_court_position = travel_leader_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same time as another similar position
			}
			trigger_if = {
				limit = { bannable_serving_diarch_trigger = yes }
				bannable_serving_diarch_trigger = no
			}
			trigger_if = {
				limit = { has_variable = gone_adventuring }
				NOT = { has_variable = gone_adventuring }
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = court_position_travel_leader_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = travel_leader_court_position
						any_court_position_holder = {
					        type = travel_leader_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = travel_leader_court_position
						any_court_position_holder = {
					        type = travel_leader_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	revoke_cost = {
		prestige = {
			value = minor_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = travel_leader_court_position
					any_court_position_holder = {
				        type = travel_leader_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.01
			supply_limit_mult = 0.02
			movement_speed = 0.01
		}
		poor = {
			monthly_court_grandeur_change_mult = 0.02
			supply_limit_mult = 0.04
			movement_speed = 0.02
		}
		average = {
			monthly_court_grandeur_change_mult = 0.03
			supply_limit_mult = 0.06
			movement_speed = 0.03
		}
		good = {
			monthly_court_grandeur_change_mult = 0.04
			supply_limit_mult = 0.08
			movement_speed = 0.04
		}
		excellent = {
			monthly_court_grandeur_change_mult = 0.05
			supply_limit_mult = 0.1
			movement_speed = 0.05
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		court_travel_leader_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		court_travel_leader_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_travel_leader_title_invalidated_effect = yes
	}

	search_for_courtier = {
		send_interface_toast = {
			title = hire_travel_leader_decision
			custom_tooltip = hire_travel_leader_decision_effect_tooltip
		}

		trigger_event = {
			id = travel_events.1010
			days = 14
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
        value = 150
        add = scope:base_value
        add = court_position_candidate_score_base_value
        add = court_position_candidate_aptitude_value

        if = {
            limit = {
                exists = scope:firing_court_position
            }
            add = 200
            scope:employee = {
                # Does the liege have a better candidate that they should be hiring instead?
                if = {
                    limit = {
                        scope:highest_available_aptitude > scope:employee_aptitude
                    }
                    add = -150
                }
            }
        }
    }
}

wet_nurse_court_position = {
	max_available_positions = 1
	category = court_position_category_common

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		if = {
			limit = { health >= 5 }
			add = {
				value = health
				multiply = 5
				add = 10
				desc = court_position_skill_health_good
			}
		}
		else_if = {
			limit = { health < 3 }
			add = {
				value = health
				multiply = 10
				add = -30
				desc = court_position_skill_health_low
			}
		}
		else = {
			add = {
				value = health
				multiply = 2
				desc = court_position_skill_health
			}
		}
		if = {
			limit = {
				any_child = {
					count >= 1
				}
			}
			add = {
				value = 15
				desc = court_position_has_child
			}
		}
		if = {
			limit = {
				has_trait = strong
			}
			add = {
				value = 15
				desc = court_position_strong_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_3
			}
			add = {
				value = 20
				desc = court_position_physique_good_3_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_2
			}
			add = {
				value = 15
				desc = court_position_physique_good_2_trait
			}
		}	
		if = {
			limit = {
				has_trait = physique_good_1
			}
			add = {
				value = 10
				desc = court_position_physique_good_1_trait
			}
		}
		if = {
			limit = {
				has_trait = loyal
			}
			add = {
				value = 10
				desc = court_position_loyal_trait
			}
		}
		add = court_position_aptitude_high_penalty_value
	}

	is_shown = {
		is_landed = yes
		has_bp2_dlc_trigger = yes
	}

	valid_position = {
		OR = {
			any_child = {
				is_adult = no
			}
			is_adult = no
			any_warden_hostage = {
				is_adult = no  
			}
		}
	}

	is_shown_character = {
		scope:employee = {
			NOT = { is_close_family_of = scope:liege }
			age < 46
			is_female = yes
			has_no_particular_noble_roots_trigger = yes
		}
	}

	valid_character = {
		scope:employee = {
			trigger_if = {
				limit = { NOT = { has_court_position = wet_nurse_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes
			}
			is_imprisoned = no
			is_courtier_of = scope:liege
			age < 46
		}
	}

	revoke_cost = {
		prestige =  {
			value = minor_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = wet_nurse_court_position
					any_court_position_holder = {
				        type = wet_nurse_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = wet_nurse_court_position
						any_court_position_holder = {
					        type = wet_nurse_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = wet_nurse_court_position
						any_court_position_holder = {
					        type = wet_nurse_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.1
		}
		poor = {
			monthly_court_grandeur_change_mult = 0.1
		}
		average = {
			monthly_court_grandeur_change_mult = 0.15
		}
		good = {
			monthly_court_grandeur_change_mult = 0.15
		}
		excellent = {
			monthly_court_grandeur_change_mult = 0.20
		}
	}

	custom_employer_modifier_description = wet_nurse_employer_custom_effect_description

	modifier = {
		monthly_prestige = medium_court_position_prestige_salary
	}
	
	search_for_courtier = {
		send_interface_toast = {
			title = find_wet_nurse_decision
			custom_tooltip = find_wet_nurse_decision_effect_tooltip
		}

		trigger_event = {
			id = bp2_decision.0001
			days = 7
		}
	}
	
	on_court_position_received = {
		wet_nurse_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		wet_nurse_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		wet_nurse_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value 
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Opinion affects how likely they are to be hired
			if = {
				limit = {
					has_relation_lover = scope:employee
				}
				add = 100
			}
			else_if = {
				limit = {
					has_relation_friend = scope:employee
				}
				add = 75
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= high_positive_opinion
					}
				}
				add = 50
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= medium_positive_opinion
					}
				}
				add = 25
			}
			if = {
				limit = {
					has_relation_nemesis = scope:employee
				}
				add = -100
			}
			else_if = {
				limit = {
					has_relation_rival = scope:employee
				}
				add = -75
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= high_negative_opinion
					}
				}
				add = -50
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= medium_negative_opinion
					}
				}
				add = -25
			}
			if = {
				limit = {
					NOT = { scope:liege.culture = scope:employee.culture }
				}
				add = -25
			}
			if = {
				limit = {
					NOT = { scope:liege.faith = scope:employee.faith }
				}
				add = -25
			}
			if = {
				limit = {
					OR = {
						AND = {
							exists = primary_heir
							primary_heir = {
								is_adult = no
								is_courtier_of = scope:liege
							}
						}
						any_child = {
							count >= 3
							is_adult = no
							is_courtier_of = scope:liege
						}
					}
				}
				add = 20
			}
		}
		add = court_position_debt_considerations_value
	}
}

court_tutor_court_position = {
	max_available_positions = 1
	category = court_position_category_common

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				diplomacy >= high_skill_rating
				martial >= high_skill_rating
				stewardship >= high_skill_rating
				intrigue >= high_skill_rating
				learning >= high_skill_rating
			}
			add = { 
				value = 20
				desc = court_position_high_skills_trait
			}
		}
		if = {
			limit = {
				has_trait = patient
			}
			add = { 
				value = 10
				desc = court_position_patient_trait
			}
		}
		if = {
			limit = {
				has_trait = shy
			}
			add = { 
				value = -10
				desc = court_position_shy_trait
			}
		}
		if = {
			limit = {
				is_landed = yes
			}
			add = {
				value = -20
				desc = court_position_landed_penalty
			}
		}
		if = {
			limit = {
				has_trait = intellect_good_3
			}
			add = { 
				value = 40
				desc = court_position_intellect_good_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_2
			}
			add = { 
				value = 20
				desc = court_position_intellect_good_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_1
			}
			add = {
				value = 10
				desc = court_position_intellect_good_1_trait
			}
		}
		else_if = {
			limit = {
				has_trait = shrewd
			}
			add = {
				value = 10
				desc = court_position_shrewd_trait
			}
		}
		if = {
			limit = {
				has_trait = reclusive
			}
			add = {
				value = -10
				desc = court_position_reclusive_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			trigger_if = {
				limit = { NOT = { has_court_position = court_tutor_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_tutor_court_position
					any_court_position_holder = {
				        type = court_tutor_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_tutor_court_position
						any_court_position_holder = {
					        type = court_tutor_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_tutor_court_position
						any_court_position_holder = {
					        type = court_tutor_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}
	
	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			learn_language_scheme_power_add = 4
		}
		poor = {
			learn_language_scheme_power_add = 8
		}
		average = {
			learn_language_scheme_power_add = 12
		}
		good = {
			learn_language_scheme_power_add = 16
		}
		excellent = {
			learn_language_scheme_power_add = 20
		}
	}

	custom_employer_modifier_description = court_tutor_employer_custom_effect_description

	base_employer_modifier = {
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		court_tutor_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		court_tutor_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_tutor_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			if = {
				limit = {
					OR = {
						AND = {
							exists = primary_heir
							primary_heir = {
								is_adult = no
								is_courtier_of = scope:liege
							}
						}
						any_child = {
							count >= 3
							is_adult = no
							is_courtier_of = scope:liege
						}
					}
				}
				add = 20
			}
			if = {
				limit = {
					has_perk = pedagogy_perk
				}
				add = 50
			}
		}
		add = court_position_debt_considerations_value
	}
}

food_taster_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 10
		add = {
			value = intrigue
			multiply = 3
			max = 50
			desc = court_position_skill_intrigue
		}
		if = {
			limit = {
				has_trait = gluttonous
			}
			add = {
				value = 25
				desc = court_position_gluttonous_trait
			}
		}
		if = {
			limit = {
				has_trait = comfort_eater
			}
			add = {
				value = 15
				desc = court_position_comfort_eater_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 15
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = inappetetic
			}
			add = {
				value = -50
				desc = court_position_inappetetic_trait
			}
		}
		if = {
			limit = {
				culture = { has_cultural_parameter = characters_are_better_food_tasters }
			}
			add = {
				value = 20
				desc = court_position_tradition_culinary_art
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			trigger_if = {
				limit = { NOT = { has_court_position = food_taster_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
			trigger_if = {
				limit = {
					scope:liege.faith = {
						NOT = { has_doctrine = doctrine_clerical_function_recruitment }
					}
				}
				is_clergy = no
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = food_taster_court_position
					any_court_position_holder = {
				        type = food_taster_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = food_taster_court_position
						any_court_position_holder = {
					        type = food_taster_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = food_taster_court_position
						any_court_position_holder = {
					        type = food_taster_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 1
		}
		poor = {
			enemy_hostile_scheme_success_chance_add = -2
			court_grandeur_baseline_add = 1
		}
		average = {
			enemy_hostile_scheme_success_chance_add = -4
			court_grandeur_baseline_add = 2
		}
		good = {
			enemy_hostile_scheme_success_chance_add = -6
			court_grandeur_baseline_add = 2
		}
		excellent = {
			enemy_hostile_scheme_success_chance_add = -10
			court_grandeur_baseline_add = 3
		}
	}

	custom_employer_modifier_description = food_taster_employer_custom_effect_description

	base_employer_modifier = {
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		food_taster_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		food_taster_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		food_taster_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
	}
}

master_of_horse_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = martial
			multiply = 2.5
			max = 50
			desc = court_position_skill_martial
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = { has_trait = overseer }
			add = {
				value = 10
				desc = court_position_overseer_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			OR = {
				is_vassal_of = scope:liege
				is_courtier_of = scope:liege
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = master_of_horse_court_position
					any_court_position_holder = {
				        type = master_of_horse_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = master_of_horse_court_position
						any_court_position_holder = {
					        type = master_of_horse_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = master_of_horse_court_position
						any_court_position_holder = {
					        type = master_of_horse_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.05
			knight_effectiveness_mult = 0.01
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.5
			knight_effectiveness_mult = 0.02
		}
		average = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.10
			knight_effectiveness_mult = 0.03
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.15
			knight_effectiveness_mult = 0.05
		}
		excellent = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.20
			knight_effectiveness_mult = 0.08
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		master_of_horse_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		master_of_horse_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		master_of_horse_title_invalidated_effect = yes
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
	}
}

master_of_hunt_court_position = {
	max_available_positions = 1
	category = court_position_category_common
	minimum_rank = county

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		add = {
			value = learning
			multiply = 1.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 100 }
			}
			add = { 
				value = 40
				desc = court_position_hunter_3_trait
			}
		}
		else_if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 50 }
			}
			add = { 
				value = 30
				desc = court_position_hunter_2_trait
			}
		}
		else_if = {
			limit = { has_trait = lifestyle_hunter }
			add = { 
				value = 20
				desc = court_position_hunter_1_trait
			}
		}
		if = {
			limit = { has_trait = brave }
			add = {
				value = 5
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = { has_trait = craven }
			add = {
				value = -10
				desc = court_position_craven_trait
			}
		}
		if = {
			limit = {
				has_character_modifier = ep2_beastmaster_modifier
			}
			add = {
				value = 10
				desc = court_position_beastmaster_modifier
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		highest_held_title_tier >= tier_county
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			NOR = {
				has_trait = blind
				has_trait = incapable
				has_trait = infirm
			}
			OR = {
				is_vassal_of = scope:liege
				is_courtier_of = scope:liege
			}
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
			trigger_if = {
				limit = { is_clergy = yes }
				faith = { has_doctrine_parameter = clergy_can_fight }
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = master_of_hunt_court_position
					any_court_position_holder = {
				        type = master_of_hunt_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = master_of_hunt_court_position
						any_court_position_holder = {
					        type = master_of_hunt_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = master_of_hunt_court_position
						any_court_position_holder = {
					        type = master_of_hunt_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	custom_employer_modifier_description = master_of_hunt_employer_custom_effect_description

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.1
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.1
		}
		average = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.15
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.15
		}
		excellent = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.20
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
		prowess = 1
	}

	on_court_position_received = {
		master_of_hunt_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		master_of_hunt_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		master_of_hunt_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely to hire if you're a hunter
			if = {
				limit = {
					has_trait = lifestyle_hunter
				}
				add = 25
			}
		}
		add = court_position_debt_considerations_value
	}
}

royal_architect_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = stewardship
			multiply = 2.5
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = architect
			}
			add = {
				value = 40
				desc = court_position_architect_trait
			}
		}
		if = { #Hard to design building if you can't see them
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			OR = {
				is_vassal_of = scope:liege
				is_courtier_of = scope:liege
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = royal_architect_court_position
					any_court_position_holder = {
				        type = royal_architect_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = royal_architect_court_position
						any_court_position_holder = {
					        type = royal_architect_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#Reduce salary for employing green architect from travel_events.2028
			if = {
				limit = {
					scope:liege = {
						employs_court_position = royal_architect_court_position
						any_court_position_holder = {
					        type = royal_architect_court_position
					        has_variable = trainee_salary
						}
					}
				}
				multiply = {
					value = 0.5
					desc = trainee_salary_mod
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = royal_architect_court_position
						any_court_position_holder = {
					        type = royal_architect_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			build_speed = -0.05
		}
		poor = {
			build_speed = -0.1
		}
		average = {
			build_speed = -0.15
		}
		good = {
			build_speed = -0.2
		}
		excellent = {
			build_speed = -0.3
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		royal_architect_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		royal_architect_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		royal_architect_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Unless you have lots of gold to spend on buildings, there's no point
			if = {
				limit = {
					short_term_gold < 500
					monthly_character_income < monthly_character_expenses_plus_fourty_percent
				}
				add = -100
			}
		}
		add = court_position_debt_considerations_value
	}
}

high_almoner_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				is_clergy = yes
			}
			add = {
				value = 20
				desc = court_position_clergy_trait
			}
		}
		if = {
			limit = {
				has_trait = generous
			}
			add = {
				value = 20
				desc = court_position_generous_trait
			}
		}
		if = {
			limit = {
				has_trait = compassionate
			}
			add = {
				value = 20
				desc = court_position_compassionate_trait
			}
		}
		if = {
			limit = {
				has_trait = greedy
			}
			add = {
				value = -10
				desc = court_position_greedy_trait
			}
		}
		if = {
			limit = {
				has_trait = profligate
			}
			add = {
				value = -10
				desc = court_position_profligate_trait
			}
		}
		if = {
			limit = {
				has_trait = avaricious
			}
			add = {
				value = -10
				desc = court_position_avaricious_trait
			}
		}
		if = {
			limit = {
				has_trait = devoted
				culture = { has_cultural_parameter = devoted_trait_bonuses }
			}
			add = {
				value = 20
				desc = tradition_monastic_communities_name
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = high_almoner_court_position
					any_court_position_holder = {
				        type = high_almoner_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = high_almoner_court_position
						any_court_position_holder = {
					        type = high_almoner_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = high_almoner_court_position
						any_court_position_holder = {
					        type = high_almoner_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}
	
	base_employer_modifier = {
		court_grandeur_baseline_add = 1
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_piety_gain_mult = 0.05
		}
		poor = {
			monthly_piety_gain_mult = 0.1
		}
		average = {
			monthly_piety_gain_mult = 0.15
			monthly_court_grandeur_change_mult = 0.1
		}
		good = {
			monthly_piety_gain_mult = 0.15
			monthly_court_grandeur_change_mult = 0.15
		}
		excellent = {
			monthly_piety_gain_mult = 0.2
			monthly_court_grandeur_change_mult = 0.2
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
		learning = 1
	}

	on_court_position_received = {
		high_almoner_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		high_almoner_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		high_almoner_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Zealous AI's like this
			if = {
				limit = {
					ai_zeal > 75
				}
				add = 50
			}
		}
		add = court_position_debt_considerations_value
	}
}

seneschal_court_position = {
	max_available_positions = 1
	category = court_position_category_common

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = stewardship
			multiply = 2.5
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				has_trait = administrator
			}
			add = {
				value = 20
				desc = court_position_administrator_trait
			}
		}
		if = {
			limit = {
				has_trait = overseer
			}
			add = {
				value = 20
				desc = court_position_overseer_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			trigger_if = {
				limit = { NOT = { has_court_position = seneschal_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = seneschal_court_position
					any_court_position_holder = {
				        type = seneschal_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = seneschal_court_position
						any_court_position_holder = {
					        type = seneschal_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = seneschal_court_position
						any_court_position_holder = {
					        type = seneschal_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
		  	monthly_county_control_change_add = 0.1
		}
		poor = {
		  	monthly_county_control_change_add = 0.1
		}
		average = {
		  	monthly_county_control_change_add = 0.2
		}
		good = {
		  	monthly_county_control_change_add = 0.2
		}
		excellent = {
		  	monthly_county_control_change_add = 0.3
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		seneschal_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		seneschal_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		seneschal_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
        if = { # Having a seneschal is excellent if you have low control
            limit = {
				scope:liege = {
					is_at_war = no
					any_held_title = {
						count >= 2
						tier = tier_county
						county_control < 100
					}
				}
            }
            add = 100
        }
        if = { # Having a seneschal is excellent if you have low control
            limit = {
				scope:liege = {
					is_at_war = no
					any_held_title = {
						count >= 4
						tier = tier_county
						county_control < 100
					}
				}
            }
            add = 200
        }
		add = court_position_seneschal_debt_considerations_value
	}
}

cupbearer_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = {
				value = 10
				desc = court_position_honest_trait
			}
		}
		if = {
			limit = {
				has_trait = trusting
			}
			add = {
				value = 10
				desc = court_position_trusting_trait
			}
		}
		if = {
			limit = {
				has_trait = deceitful
			}
			add = {
				value = -10
				desc = court_position_deceitful_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}
	
	# Is this an available position for this court? (root is court owner)
	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			trigger_if = {
				limit = { NOT = { has_court_position = cupbearer_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = cupbearer_court_position
					any_court_position_holder = {
				        type = cupbearer_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = cupbearer_court_position
						any_court_position_holder = {
					        type = cupbearer_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = cupbearer_court_position
						any_court_position_holder = {
					        type = cupbearer_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.05
		}
		poor = {
			monthly_court_grandeur_change_mult = 0.10
		}
		average = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.10
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.10
		}
		excellent = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.15
		}
	}

	custom_employer_modifier_description = cupbearer_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		cupbearer_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		cupbearer_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		cupbearer_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
	}
}

chief_eunuch_court_position = {
	max_available_positions = 1
	category = court_position_category_special
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		add = {
			value = intrigue
			multiply = 2.5
			desc = court_position_skill_intrigue
		}
		if = {
			limit = {
				is_landed = yes
			}
			add = {
				value = -20
				desc = court_position_landed_penalty
			}
		}
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		if = {
			limit = {
				has_trait = infirm
			}
			add = {
				value = -75
				desc = court_position_infirm_trait
			}
		}
		add = court_position_aptitude_family_business_value
	}

	# Is this an available position for this court? (root is court owner)
	is_shown = {
		culture = { # Culture that has eunuchs
			has_cultural_parameter = can_appoint_chief_eunuch
		}
	}
	
	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			has_trait = eunuch
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = chief_eunuch_court_position
					any_court_position_holder = {
				        type = chief_eunuch_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = chief_eunuch_court_position
						any_court_position_holder = {
					        type = chief_eunuch_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = chief_eunuch_court_position
						any_court_position_holder = {
					        type = chief_eunuch_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.05
			hostile_scheme_resistance_mult = 0.02
			hostile_scheme_power_mult = 0.02
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.05
			hostile_scheme_resistance_mult = 0.04
			hostile_scheme_power_mult = 0.04
		}
		average = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.10
			hostile_scheme_resistance_mult = 0.08
			hostile_scheme_power_mult = 0.08
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.10
			hostile_scheme_resistance_mult = 0.16
			hostile_scheme_power_mult = 0.16
		}
		excellent = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.15
			hostile_scheme_resistance_mult = 0.32
			hostile_scheme_power_mult = 0.32
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		chief_eunuch_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		chief_eunuch_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		chief_eunuch_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_debt_considerations_value
	}
}

court_jester_court_position = {
	max_available_positions = 1
	category = court_position_category_common
	minimum_rank = duchy

	opinion = {
		value = court_jester_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = { 
				value = 20
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = stubborn
			}
			add = { 
				value = 20
				desc = court_position_stubborn_trait
			}
		}
		if = {
			limit = {
				has_trait = shrewd
			}
			add = { 
				value = 20
				desc = court_position_shrewd_trait
			}
		}
		if = {
			limit = {
				has_trait = poet
			}
			add = { 
				value = 10
				desc = court_position_poet_trait
			}
		}
		if = { # An acrobatic jester is a good jester
			limit = {
				has_trait = athletic
			}
			add = { 
				value = 10
				desc = court_position_athletic_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		highest_held_title_tier >= tier_duchy
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			OR = {
				is_vassal_of = scope:liege
				is_courtier_of = scope:liege
			}
			trigger_if = {
				limit = { NOT = { has_court_position = court_jester_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_jester_court_position
					any_court_position_holder = {
				        type = court_jester_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_jester_court_position
						any_court_position_holder = {
					        type = court_jester_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_jester_court_position
						any_court_position_holder = {
					        type = court_jester_court_position
					        has_variable = king_of_fools_var
						}
					}
				}
				multiply = {
					value = 0.25
					desc = king_of_fools_salary
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_jester_court_position
						any_court_position_holder = {
					        type = court_jester_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	custom_employer_modifier_description = court_jester_employer_custom_effect_description

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			monthly_court_grandeur_change_mult = 0.1
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.1
		}
		average = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.15
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.15
		}
		excellent = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.20
		}
	}

	modifier = {
		monthly_prestige = -0.5
		hostile_scheme_power_mult = -0.25
		owned_hostile_scheme_success_chance_add = -10
	}

	on_court_position_received = {
		court_jester_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		court_jester_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_jester_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely for very stressed characters 
			if = {
				limit = {
					stress_level >= 1
				}
				add = 20
			}
		}
		scope:employee = {
			if = {
				limit = {
					OR = {
						is_close_family_of = scope:liege
						is_consort_of = scope:liege
						is_ruler = yes
						AND = {
							exists = dynasty
							dynasty = {
								any_dynasty_member = {
									count <= 2
								}
							}
						}
						is_clergy = yes
						is_theocratic_lessee = yes
					}
					NOR = {
						has_relation_potential_rival = scope:liege
						has_relation_rival = scope:liege
					}
				}
				add = -1000
			}
		}
		add = court_position_debt_considerations_value
	}
}

court_poet_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		add = {
			value = learning
			multiply = 1
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 15
				desc = court_position_gregarious_trait
			}
		}
		if = { #Cultural Tradition that improves the aptitude of characters of that culture
			limit = {
				culture = { has_cultural_parameter = characters_are_better_court_poets }
			}
			add = {
				value = 20
				desc = court_position_tradition_poetry
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			has_trait = poet
			trigger_if = {
				limit = { NOT = { has_court_position = court_poet_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_poet_court_position
					any_court_position_holder = {
				        type = court_poet_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_poet_court_position
						any_court_position_holder = {
					        type = court_poet_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_poet_court_position
						any_court_position_holder = {
					        type = court_poet_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 1
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.05
		}
		average = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.10
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.15
		}
		excellent = {
			court_grandeur_baseline_add = 3
			monthly_court_grandeur_change_mult = 0.20
		}
	}
	
	custom_employer_modifier_description = court_poet_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		court_poet_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		court_poet_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_poet_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		scope:liege = {
			# More likely for very generous characters 
			if = {
				limit = {
					ai_greed <= -75
				}
				add = 25
			}
			# Lots of gold to spend on inspirations!
			if = {
				limit = {
					gold >= 500
					monthly_character_income > monthly_character_expenses_plus_fourty_percent
				}
				add = 50
			}
		}
		add = court_position_debt_considerations_value
	}
}

court_musician_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 30
				desc = court_position_gregarious_trait
			}
		}
		if = { #Being a poet helps a little bit
			limit = {
				has_trait = poet
			}
			add = {
				value = 10
				desc = court_position_poet_trait
			}
		}
		if = {
			limit = {
				has_trait = shy
			}
			add = {
				value = -10
				desc = court_position_shy_trait
			}
		}
		if = { #Cultural Tradition that improves the aptitude of characters of that culture
			limit = {
				culture = { has_cultural_parameter = characters_are_better_court_musicians }
			}
			add = {
				value = 20
				desc = court_position_tradition_music_theory
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			trigger_if = {
				limit = { NOT = { has_court_position = court_musician_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_musician_court_position
					any_court_position_holder = {
				        type = court_musician_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_musician_court_position
						any_court_position_holder = {
					        type = court_musician_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_musician_court_position
						any_court_position_holder = {
					        type = court_musician_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 1
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_court_grandeur_change_mult = 0.05
		}
		average = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.10
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_court_grandeur_change_mult = 0.15
		}
		excellent = {
			court_grandeur_baseline_add = 3
			monthly_court_grandeur_change_mult = 0.20
		}
	}

	custom_employer_modifier_description = court_musician_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		court_musician_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		court_musician_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_musician_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_debt_considerations_value
	}
}

bodyguard_court_position = {
	max_available_positions = 2

	category = court_position_category_common

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = prowess
			multiply = 4
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = shieldmaiden
			}
			add = {
				value = 20
				desc = court_position_shieldmaiden_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = {
				value = 15
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = {
				value = 10
				desc = court_position_blademaster_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = {
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		if = {
			limit = {
				has_trait = gallant
			}
			add = {
				value = 5
				desc = court_position_gallant_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 20
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = paranoid
			}
			add = {
				value = 10
				desc = court_position_paranoid_trait
			}
		}
		if = {
			limit = {
				has_trait = craven
			}
			add = {
				value = -15
				desc = court_position_craven_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
			trigger_if = {
				limit = { NOT = { has_court_position = bodyguard_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = bodyguard_court_position
					any_court_position_holder = {
				        type = bodyguard_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = bodyguard_court_position
						any_court_position_holder = {
					        type = bodyguard_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#Set to 0 with our psycho bodyguard from travel_events.2040
			if = {
				limit = {
					scope:liege = {
						employs_court_position = bodyguard_court_position
						any_court_position_holder = {
					        type = bodyguard_court_position
					        has_variable = insane_bodyguard
						}
					}
				}
				multiply = {
					value = 0.0
					desc = insane_bodyguard_salary_mod
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = bodyguard_court_position
						any_court_position_holder = {
					        type = bodyguard_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
	}

	custom_employer_modifier_description = bodyguard_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		bodyguard_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		bodyguard_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		bodyguard_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely if you're scared all the time
			if = {
				limit = {
					has_trait = paranoid
				}
				add = 50
			}

			# Less likely to hire an additional one if you're already employing one
			if = {
				limit = {
					employs_court_position = bodyguard_court_position
				}
				add = -50
			}
		}
		add = court_position_debt_considerations_value
	}
}

champion_court_position = {
	max_available_positions = 1
	category = court_position_category_common

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = prowess
			multiply = 4
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = {
				value = 30
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = {
				value = 15
				desc = court_position_blademaster_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = {
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		if = {
			limit = {
				has_trait = shieldmaiden
			}
			add = { 
				value = 20
				desc = court_position_shieldmaiden_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = { 
				value = 20
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = craven
			}
			add = { 
				value = -10
				desc = court_position_craven_trait
			}
		}
		if = {
			limit = {
				is_landed = yes
			}
			add = {
				value = -20
				desc = court_position_landed_penalty
			}
		}
		if = {
			limit = {
				has_trait = maimed
			}
			add = {
				value = -50
				desc = court_position_maimed_trait
			}
		}
		if = {
			limit = {
				has_trait = wounded_3
			}
			add = {
				value = -50
				desc = court_position_wounded_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = wounded_2
			}
			add = {
				value = -25
				desc = court_position_wounded_2_trait
			}
		}
		#Wounded_1 is ok since it's not a serious injury... yet
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		if = {
			limit = {
				has_trait = infirm
			}
			add = {
				value = -75
				desc = court_position_infirm_trait
			}
		}
		add = court_position_aptitude_family_business_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = champion_court_position
					any_court_position_holder = {
				        type = champion_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = champion_court_position
						any_court_position_holder = {
					        type = champion_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = champion_court_position
						any_court_position_holder = {
					        type = champion_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			dread_decay_mult = -0.05
		}
		poor = {
			dread_decay_mult = -0.1
		}
		average = {
			monthly_prestige = 0.05
			dread_decay_mult = -0.15
		}
		good = {
			monthly_prestige = 0.1
			dread_decay_mult = -0.20
		}
		excellent = {
			monthly_prestige = 0.2
			dread_decay_mult = -0.25
		}
	}

	custom_employer_modifier_description = champion_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		champion_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		champion_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		champion_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 25
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value

		scope:liege = {
			# More likely to hire one if you can't fight yourself
			if = {
				limit = {
					NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege } }
				}
				add = 50
			}
			# Less likely to hire one if you have high prowess
			if = {
				limit = {
					prowess >= high_skill_rating
				}
				add = -25
			}
			else_if = {
				limit = {
					prowess >= medium_skill_rating
				}
				add = -10
			}
		}
		add = court_position_debt_considerations_value
	}
}

executioner_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom # Should only be available for kings and emperors

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = intrigue
			multiply = 2.5
			max = 50
			desc = court_position_skill_intrigue
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = torturer
			}
			add = {
				value = 25
				desc = court_position_torturer_trait
			}
		}
		if = {
			limit = {
				has_trait = sadistic
			}
			add = {
				value = 20
				desc = court_position_sadistic_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
	}

	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			is_ruler = no
			OR = {
				trigger_if = { # Done to hide the tooltip
					limit = { has_court_position = executioner_court_position }
					always = yes
				}
				custom_tooltip = {
					text = has_imprisonment_reason_no_subject
					scope:liege = {
						has_imprisonment_reason = prev
					}
				}
				trigger_if = { # Imprisoned characters should only be valid if they aren't already the executioner
					limit = {
						NOT = { has_court_position = executioner_court_position }
					}
					is_imprisoned_by = scope:liege
				}
				custom_tooltip = {
					text = has_strong_hook_no_subject
					scope:liege = { has_strong_usable_hook = prev }
				}
			}
			trigger_if = {
				limit = { NOT = { has_court_position = executioner_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = executioner_court_position
					any_court_position_holder = {
				        type = executioner_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = executioner_court_position
						any_court_position_holder = {
					        type = executioner_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = executioner_court_position
						any_court_position_holder = {
					        type = executioner_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			dread_gain_mult = 0.05
			dread_decay_mult = -0.05
		}
		poor = {
			dread_gain_mult = 0.1
			dread_decay_mult = -0.1
		}
		average = {
			dread_gain_mult = 0.15
			dread_decay_mult = -0.15
		}
		good = {
			dread_gain_mult = 0.20
			dread_decay_mult = -0.20
		}
		excellent = {
			dread_gain_mult = 0.25
			dread_decay_mult = -0.25
		}
	}

	custom_employer_modifier_description = executioner_employer_custom_effect_description

	modifier = {
		monthly_prestige = minor_court_position_prestige_cost
	}

	on_court_position_received = {
		# Consume hook if that is what is being used to assign them as Executioner
		scope:liege = {
			if = {
				limit = {
					NOR = {
						has_imprisonment_reason = scope:employee
						scope:employee = { is_imprisoned_by = scope:liege }
					}
					has_usable_hook = scope:employee
				}
				use_hook = scope:employee
			}
		}
		executioner_title_accepted_effect = yes
	}
	on_court_position_revoked = { 
		executioner_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		executioner_title_invalidated_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely to hire one if you have high dread
			if = {
				limit = {
					dread > medium_dread
				}
				add = 25
			}
			# More likely if you have dread-traits
			if = {
				limit = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = arbitrary
					}
				}
				add = 25
			}
		}
		add = court_position_debt_considerations_value
	}
}

court_artificer_court_position = {
	max_available_positions = 3
	category = court_position_category_royal
	minimum_rank = kingdom

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = prowess
			desc = court_position_skill_intrigue
		}
		add = {
			value = diplomacy
			desc = court_position_skill_diplomacy
		}
		add = {
			value = intrigue
			desc = court_position_skill_intrigue
		}
		add = {
			value = learning
			desc = court_position_skill_learning
		}
		add = {
			value = martial
			desc = court_position_skill_martial
		}
		add = {
			value = stewardship
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				has_character_modifier = local_artisan_modifier
			}
			add = {
				value = -20
				desc = local_artisan_modifier
			}
		}
		add = court_position_aptitude_family_business_value
		#add = court_position_aptitude_high_penalty_value
	}

	is_shown = {
		has_royal_court = yes
		has_ep1_court_positions_dlc_trigger = yes
	}

	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			OR = {
				has_completed_inspiration = yes
				custom_tooltip = {
					text = has_an_inspiration
					exists = inspiration
				}
			}
			is_imprisoned = no
		}
	}

	valid_character = {
		scope:employee = {
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			OR = {
				custom_tooltip = {
					text = has_a_completed_inspiration
					has_completed_inspiration = yes
				}
				custom_tooltip = {
					text = has_an_inspiration
					exists = inspiration
				}
			}
			trigger_if = {
				limit = { NOT = { has_court_position = court_artificer_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_artificer_court_position
					any_court_position_holder = {
				        type = court_artificer_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_artificer_court_position
						any_court_position_holder = {
					        type = court_artificer_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_artificer_court_position
						any_court_position_holder = {
					        type = court_artificer_court_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 0
		}
		poor = {
			court_grandeur_baseline_add = 1
		}
		average = {
			court_grandeur_baseline_add = 1
		}
		good = {
			court_grandeur_baseline_add = 2
		}
		excellent = {
			court_grandeur_baseline_add = 2
		}
	}

	custom_employer_modifier_description = court_artificer_employer_custom_effect_description

	modifier = {
		monthly_prestige = major_court_position_prestige_salary
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
		scope:employee = {
			# Moves to pool after 1 day
			# Moving them directly here would invalidate the court position too early
			trigger_event = {
				id = courtier_guest_management.0999
				days = 1
			}
		}
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Unless you have lots of gold to spend, there's no point
			if = {
				limit = {
					short_term_gold < 500
					monthly_character_income < monthly_character_expenses_plus_fourty_percent
				}
				add = -100
			}
		}
		add = court_position_debt_considerations_value
	}
}

court_cave_hermit_position = {
	max_available_positions = 1
	category = court_position_category_special
	
	is_shown = {
		has_variable = encountered_recruitable_hermit #you need to have encountered a Court Hermit before you come up with this yourself
	}

	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				has_trait = lifestyle_mystic
				has_trait_xp = {
					trait = lifestyle_mystic
					value >= 100
				}
			}
			add = { 
				value = 20
				desc = court_position_mystic_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_mystic
				has_trait_xp = {
					trait = lifestyle_mystic
					value >= 50
				}
			}
			add = { 
				value = 10
				desc = court_position_mystic_2_trait
			}
		}
		else_if = {
			limit = { 
				has_trait = lifestyle_mystic
			}
			add = { 
				value = 5
				desc = court_position_mystic_1_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 10
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_gardener
			}
			add = {
				value = 10
				desc = court_position_gardener_trait
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
		}
	}

	valid_character = {
		scope:employee = {
			is_imprisoned = no
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			has_trait = lifestyle_mystic
			has_trait_xp = {
				trait = lifestyle_mystic
				value >= 50
			}
			trigger_if = {
				limit = { NOT = { has_court_position = court_cave_hermit_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost 

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_cave_hermit_position
					any_court_position_holder = {
				        type = court_cave_hermit_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = court_position_antiquarian_salary #it's cheap to maintain a hermit in a cave
			# Set to 50% if you found your hermit around (variable lasts for 5 years)
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_cave_hermit_position
						any_court_position_holder = {
					        type = court_cave_hermit_position
					        has_variable = found_hermit_mod
						}
					}
				}
				multiply = {
					value = 0.0
					desc = found_hermit_mod
				}
			}
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_cave_hermit_position
						any_court_position_holder = {
					        type = court_cave_hermit_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_cave_hermit_position
						any_court_position_holder = {
					        type = court_cave_hermit_position
					        scope:liege = {
								has_hook_of_type = {
									type = obligation_hook
									target = prev
								}
							}
						}
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 0
		}
		poor = {
			court_grandeur_baseline_add = 1
			monthly_prestige = 0.1
		}
		average = {
			court_grandeur_baseline_add = 1
			monthly_prestige = 0.25
		}
		good = {
			court_grandeur_baseline_add = 2
			monthly_prestige = 0.5
		}
		excellent = {
			court_grandeur_baseline_add = 2
			monthly_prestige = 1
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = { 
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		scope:liege = {
			# More likely for very generous characters 
			if = {
				limit = {
					ai_greed <= -75
				}
				add = 25
			}
			# Lots of gold to spend on inspirations!
			if = {
				limit = {
					gold >= 500
					monthly_character_income > monthly_character_expenses_plus_fourty_percent
				}
				add = 50
			}
		}
		add = court_position_debt_considerations_value
	}
}

####FP3 Additions####
master_assassin_court_position = {
	max_available_positions = 1
	category = court_position_category_special
	minimum_rank = county


	opinion = {
		value = regular_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = {
			value = intrigue
			multiply = 1.25
			max = 50
			desc = court_position_skill_intrigue
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = { 
				value = 15
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = { 
				value = 10
				desc = court_position_blademaster_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = { 
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		if = {
			limit = {
				has_trait = deceitful
			}
			add = {
				value = 10
				desc = court_position_deceitful_trait
			}
		}
		if = {
			limit = {
				has_trait = murderer
			}
			add = {
				value = 20
				desc = court_position_murderer_trait
			}
		}
		if = {
			limit = {
				has_trait = order_member
			}
			add = {
				value = 25
				desc = court_position_order_member_trait
			}
		}
		if = {
			limit = {
				has_trait = faith_warrior
			}
			add = {
				value = 25
				desc = court_position_faith_warrior_trait
			}
		}
		if = {
			limit = {
				has_trait = zealous
			}
			add = {
				value = 25
				desc = court_position_zealous_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 25
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = compassionate
			}
			add = {
				value = -50
				desc = court_position_compassionate_trait
			}
		}
		if = {
			limit = {
				has_trait = just
			}
			add = {
				value = -20
				desc = court_position_just_trait
			}
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = {
				value = -20
				desc = court_position_honest_trait
			}
		}

		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
	}


	is_shown = {
		faith = {
			has_doctrine = tenet_fp3_fedayeen
		}
	}

	valid_position = { 
		faith = {
			has_doctrine = tenet_fp3_fedayeen
		}
	}

	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
		}
	}

	valid_character = {
		scope:employee = {
			has_no_particular_noble_roots_trigger = yes
			custom_tooltip = {
				text = IS_NOT_THE_SPOUSE_OF_CHARACTER_COURT_POSITION
				NOT = { is_spouse_of = scope:liege }
			}
			is_imprisoned = no
			is_landed = no #You can't be a public figure and a master assassin 
			faith = {
				has_doctrine = tenet_fp3_fedayeen
				NOR = {
					has_doctrine = tenet_pacifism
					has_doctrine = tenet_dharmic_pacifism 
				}
			}
			trigger_if = {
				limit = {
					scope:liege.faith = {
						has_doctrine = doctrine_gender_male_dominated
					}
				}
				is_male = yes
			}
			trigger_if = {
				limit = {
					scope:liege.faith = {
						has_doctrine = doctrine_gender_female_dominated
					}
				}
				is_female = yes
			}
			trigger_if = {
				limit = { NOT = { has_court_position = master_assassin_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}


	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = master_assassin_court_position
					any_court_position_holder = {
				        type = master_assassin_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = master_assassin_court_position
						any_court_position_holder = {
					        type = master_assassin_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			hostile_scheme_power_mult = 0.04
			enemy_hostile_scheme_success_chance_add = -2
		}
		poor = {
			hostile_scheme_power_mult = 0.08
			enemy_hostile_scheme_success_chance_add = -4
		}
		average = {
			hostile_scheme_power_mult = 0.12
			enemy_hostile_scheme_success_chance_add = -6
		}
		good = {
			hostile_scheme_power_mult = 0.16
			enemy_hostile_scheme_success_chance_add = -8
		}
		excellent = {
			hostile_scheme_power_mult = 0.2
			enemy_hostile_scheme_success_chance_add = -10 
		}
	}

	modifier = {
		monthly_prestige = minor_court_position_prestige_cost
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
		scope:employee = {
			# Moves to pool after 1 day
			# Moving them directly here would invalidate the court position too early
			trigger_event = {
				id = courtier_guest_management.0999
				days = 1
			}
		}
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely to hire one if you have high dread
			if = {
				limit = {
					dread > medium_dread
				}
				add = 25
			}
			# More likely if you have dread-traits
			if = {
				limit = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = arbitrary
					}
				}
				add = 25
			}
			# More likely if you are a zealous jihadist
			if = {
				limit = {
					has_trait = zealous
				}
				add = 25
			}
		}
		add = court_position_debt_considerations_value
	}	
}

court_scholar_court_position = {
	max_available_positions = 1
	category = court_position_category_royal
	minimum_rank = kingdom

	opinion = {
		value = ceremonial_court_position_opinion
	}
	
	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 0
		add = {
			value = learning
			multiply = 4
			desc = court_position_skill_learning
			max = 65
		}
		if = {
			limit = {
				scope:liege.dynasty ?= { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = { has_trait = theologian }
			add = {
				value = 15
				desc = court_position_theologian_trait
			}
		}
		if = {
			limit = { has_trait = scholar }
			add = {
				value = 15
				desc = court_position_scholar_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_physician
				has_trait_xp = {
					trait = lifestyle_physician
					value >= 100
				}
			}
			add = { 
				value = 15
				desc = court_position_physician_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_physician
				has_trait_xp = {
					trait = lifestyle_physician
					value >= 50
				}
			}
			add = { 
				value = 10
				desc = court_position_physician_2_trait
			}
		}
		else_if = {
			limit = { has_trait = lifestyle_physician }
			add = { 
				value = 5
				desc = court_position_physician_1_trait
			}
		}
		if = {
			limit = {
				has_trait = intellect_good_3
			}
			add = { 
				value = 20
				desc = court_position_intellect_good_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_2
			}
			add = { 
				value = 15
				desc = court_position_intellect_good_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_1
			}
			add = {
				value = 10
				desc = court_position_intellect_good_1_trait
			}
		}
		else_if = {
			limit = {
				has_trait = shrewd
			}
			add = {
				value = 10
				desc = court_position_shrewd_trait
			}
		}
		if = {
			limit = {
				scope:liege.culture ?= {
					has_innovation = fp3_innovation_mural_sextant
				}
			}
			add = {
				value = 10
				desc = court_position_innovation_mural_sextant
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	}

	is_shown = {
		has_fp3_dlc_trigger = yes
		culture = { has_cultural_parameter = can_appoint_court_scholar }
	}

	# Only Kingdoms+ can attract prominent enough scholars
	valid_position = {
		highest_held_title_tier >= tier_kingdom
	}

	valid_character = {
		scope:employee = {
			is_courtier_of = scope:liege #A requirement for inspirations
			OR = {
				is_imprisoned = no
				is_imprisoned_by = scope:liege
			}
			is_ai = yes
			trigger_if = {
				limit = { NOT = { has_court_position = court_scholar_court_position } }
				court_position_does_not_already_have_a_job_trigger = yes # This positions is considered a job, and cannot be held at the same tims as another similar position
			}
		}
	}

	revoke_cost = {
		prestige =  {
			value = major_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = court_tutor_court_position
					any_court_position_holder = {
				        type = court_tutor_court_position
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = court_scholar_court_position
						any_court_position_holder = {
					        type = court_scholar_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0.0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}
	
	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints) 
	scaling_employer_modifiers = {
		terrible = {
			cultural_head_fascination_mult = 0.02
			monthly_court_grandeur_change_mult = 0.05
		}
		poor = {
			cultural_head_fascination_mult = 0.04
			monthly_court_grandeur_change_mult = 0.05
		}
		average = {
			learning = 1
			cultural_head_fascination_mult = 0.06
			monthly_court_grandeur_change_mult = 0.10
		}
		good = {
			learning = 2
			cultural_head_fascination_mult = 0.08
			monthly_court_grandeur_change_mult = 0.10
		}
		excellent = {
			learning = 3
			cultural_head_fascination_mult = 0.10
			monthly_court_grandeur_change_mult = 0.15
		}
	}

	# custom_employer_modifier_description = court_scholar_employer_custom_effect_description

	base_employer_modifier = {
	}

	modifier = {
		monthly_prestige = medium_court_position_prestige_salary
		learning = 2
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			if = {
				limit = { has_trait = scholar }
				add = 25
			}
			if = {
				limit = { has_education_learning_trigger = yes }
				add = 50
			}
			if = {
				limit = {
					has_lifestyle = learning_lifestyle
				}
				add = 100
			}
		}
		if = {
			limit = {
				exists = scope:firing_court_position
			}
			add = 100
			scope:employee = {
				# Does the liege have a better candidate that they should be hiring instead?
				if = {
					limit = {
						scope:highest_available_aptitude > scope:employee_aptitude
					}
					add = -75
 				}
			}
		}
		add = court_position_debt_considerations_value
	}
}

